package com.poem.mapper;

import com.github.pagehelper.Page;
import com.poem.annotation.AutoFill;
import com.poem.dto.AuthorsPageQueryDTO;
import com.poem.entity.Authors;
import com.poem.enumeration.OperationType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @ClassName: AuthorsMapper
 * @Author: YLY
 * @Description:
 * @Date: 2025/10/14
 * @Version: 1.0
 */

@Mapper
public interface AuthorsMapper {

    /**
     * 查询所有作者
     * 
     * @return
     */
    @Select("select * from authors order by update_time desc ")
    List<Authors> queryAllAuthors();

    /**
     * 修改作者
     * 
     * @param author
     */
    @AutoFill(value = OperationType.UPDATE)
    void updateAuthor(Authors author);

    /**
     * 添加作者
     * 
     * @param author
     */
    @AutoFill(value = OperationType.INSERT)
    void addAuthor(Authors author);

    Page<Authors> pageQuery(AuthorsPageQueryDTO authorsPageQueryDTO);

    void deleteBatch(List<Long> ids);

    @Select("select * from authors where id = #{id}")
    Authors getById(Long id);

    List<Authors> getAuthors(List<Long> ids);
}